<?
require("config.php");

$location_status .= "| Add";
$show_backnav = "menu";
$menutype = 2;

if (NULL!=$action){

	$dir = $table . "/";

	if ($Picture1) myUpload($Picture1,$Picture1_name,$dir);
	if ($Picture2) myUpload($Picture2,$Picture2_name,$dir);

	if ($sm_Picture1) myUpload($sm_Picture1,"sm_" . $Picture1_name,$dir);
	if ($sm_Picture2) myUpload($sm_Picture2,"sm_" . $Picture2_name,$dir);


   $field = array(
	"code",
	"name",
	"email",
	"phone",
	"picture1",
	"picture2",
	"brief",
	"details",
	"status",
	"publish_date",
	"sex",
	"duty",
	"accept",
	"email_alert",
	"aorder",
	);


   $content = array(
	$Code,
	$Name,
	$Email,
	$Phone,
	$Picture1_name,
	$Picture2_name,
	$Brief,
	$Details,
	$Status,
	"$myYear-$myMonth-$myDay",
	$Sex,
	$Duty,
	$Accept,
	$Email_alert,
	$aorder,
	);

   myInsert($table,$field,$content);


   header("location:" . $rela_path . "share/msg.php?v=721");

   exit();

}

if (checkCode($table,$Code)){

	header("location:" . $rela_path . "share/msg.php?v=9001");
	exit();
}


require($rela_path . "inc/header.php");
require($rela_path . "bin/date.php");
require($rela_path . "bin/country.php");
?> 
<form action="" method="post" enctype="multipart/form-data" name="form1">
<!--hidden filed-->
<input name="action" type="hidden" value="add">
<input name="Code" type="hidden" value="<?print($Code)?>">

<input name="bk_Picture_sm" type="hidden" value="<?print($Picture_sm)?>">
<input name="bk_Picture" type="hidden" value="<?print($Picture)?>">

  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right"> <input name="image" type="image" onclick="Redirect('menu.php',1);return false;" src="../../images/bt_cancel.gif" width="78" height="23"> 
        <input name="image" type="image" src="../../images/bt_save.gif" width="76" height="22"  <?print($active)?>> 
      </td>
    </tr>
  </table>
  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right">&nbsp; </td>
    </tr>
    <tr> 
      <td><table border="0">
          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td class="tdheader">Code :</td>
            <td> <?print($Code)?>  </td>
          </tr>

          <tr> 
            <td class="tdheader">Name :</td>
            <td> <input class="text" name="Name" type="text" value="" size="50"> 
            </td>
          </tr>

          <tr> 
            <td class="tdheader">Sex :</td>
            <td>
			
<?

$sourceData = array(
	"Mr.",
	"Ms.",
	"Mrs.",
);

$sourceLabel = $sourceData;

FFPCheckBox("Sex",$Sex,$sourceData,$sourceLabel)

?>
            </td>
          </tr>



          <tr> 
            <td class="tdheader">Status :</td>
            <td>
			
<?

$sourceData = array(
	"0",
	"1",
);

$sourceLabel = array(
	"Trainer",
	"Coach",
);

FFPCheckBox("Duty",$Duty,$sourceData,$sourceLabel)

?>
            </td>
          </tr>




          <tr> 
            <td class="tdheader">Coaching Booking :</td>
            <td>
			
<?

$sourceData = array(
	"0",
	"1",
);

$sourceLabel = array(
	"Yes",
	"No",
);

FFPCheckBox("Accept",$Accept,$sourceData,$sourceLabel)

?>
            </td>
          </tr>

          <tr> 
            <td class="tdheader">Booking Alert:</td>
            <td>
			
<?

$sourceData = array(
	"1",
	"0",
);

$sourceLabel = array(
	"Yes",
	"No",
);

FFPCheckBox("Email_alert",$Email_alert,$sourceData,$sourceLabel)

?>
            </td>
          </tr>
          <tr> 
            <td class="tdheader">E-mail :</td>
            <td><input class="text" name="Email" type="text" value="" size="50"></td>
          </tr>
          <tr> 
            <td class="tdheader">Contact Phone :</td>
            <td><input class="text" name="Phone" type="text" value="" size="50"></td>
          </tr>
          <tr>
            <td class="tdheader">Picture 1</td>
            <td>
              <input type="file" class="text" name="Picture1" size="40" />
              <br />
              <b>(Smaller Picture)</b><br />
              <input type="file" class="text" name="sm_Picture1" size="40" />
              <br />
              <br />
            </td>
          </tr>
          <tr>
            <td class="tdheader">Picture 2</td>
            <td>
              <input type="file" class="text" name="Picture2" size="40" />
              <br />
              <b>(Smaller Picture)</b><br />
              <input type="file" class="text" name="sm_Picture2" size="40" />
              <br />
              <br />
            </td>
          </tr>
          
          <tr> 
            <td class="tdheader">Brief :</td>
            <td><textarea class="text" name="Brief" cols="50" rows="4"></textarea></td>
          </tr>
          <tr> 
            <td class="tdheader">Details :</td>
            <td> <textarea class="text" name="Details" cols="60" rows="30"></textarea> 
            </td>
          </tr>          <tr> 
            <td class="tdheader">Publish :</td>
            <td>
              <?

$sourceData = array(
  "Yes",
  "No",
  );

$sourceLabel=$sourceData;

$boxName="Status";

$value=$Status;

FFPCheckBox("Status",$Status,$sourceData,$sourceLabel);

?>          
            </tr>
          <tr> 
            <td class="tdheader">Publishing Date : </td>
            <td><?print(FFPtime(date("Y-m-d H:i")))?></td>
          </tr>
          <tr>
            <td class="tdheader">Appearance Order  :</td>
            <td>
              <input name="aorder" type="text" class="text" id="aorder" value="" size="4" maxlength="4"> 
              (smaller number on top) </td>
          </tr>

          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
  </table>
  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right"> <input name="image2" type="image" onclick="Redirect('menu.php',1);return false;" src="../../images/bt_cancel.gif" width="78" height="23"> 
        <input name="image2" type="image" src="../../images/bt_save.gif" width="76" height="22" <?print($active)?>> 
      </td>
    </tr>
  </table>
</form>
<?
require($rela_path . "inc/footer.php");
?>

